package cn.lutu.domain.repository.impl;

import cn.lutu.dao.mapper.CommentMapper;
import cn.lutu.domain.repository.CommentRepository;
import cn.lutu.protocol.entity.Comment;
import cn.lutu.protocol.vo.CommentVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class CommentRepositoryImpl implements CommentRepository {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public int insert(Comment comment) {
        log.debug("开始处理发表评论业务,参数: {}",comment);
        return commentMapper.insert(comment);
    }

    @Override
    public List<CommentVO> selectById(Long id) {
        log.debug("开始处理获取评论列表业务,参数: {}",id);
        List<CommentVO> list =commentMapper.selectById(id);
        return list;
    }

    @Override
    public void deleteById(Long id) {
        log.debug("开始处理删除评论业务,参数: {}",id);
        commentMapper.deleteById(id);
    }


}
